#ifndef EGG_GPUPARAM_H
#define EGG_GPUPARAM_H

#include "Texture.h"

namespace egg{

    class GPUParam{
    public:
        GPUParam();
        GPUParam(GLenum _type,const string& _name);
        GPUParam(GPUParamType _type,const string& _name);
    public:
        inline const string& getName() const{
            return mName;
        }
        inline GPUParamType getType() const{
            return mType;
        }
        inline uint32 getSize() const{
            return mSize;
        }
    protected:
        string mName;
        uint32 mSize;
        GPUParamType mType;
    };
    typedef shared_ptr<GPUParam> GPUParamPtr;

    class NumericParam:public GPUParam{
    public:
        NumericParam(GPUParamType _type,const string& _name);
        NumericParam(const GPUParam& _other);

        inline void* getData() const{
            return mData;
        }
        template<class T>
        inline void set(const T& value){
            memcpy(mData,&value,mSize);
        }
        template<class T>
        inline T& getRef(){
            return *((T*)(mData));
        }
        template<class T>
        inline T* getPtr(){
            return ((T*)(mData));
        }
        template<class T>
        inline const T& getConstRef(){
            return *((T*)(mData));
        }

    protected:
        byte* mData;
    };
    typedef shared_ptr<NumericParam> NumericParamPtr;

    class TextureParam:public GPUParam{
    public:
        TextureParam(const string& _name);
        TextureParam(const GPUParam& _other);
    public:
        GLenum mSWrap;
        GLenum mTWrap;
        TexturePtr mTexture;
    };
    typedef shared_ptr<TextureParam> TextureParamPtr;

}

#endif